<?php
/***********************************************************************
 * @package     IvanEngine
 * @subpackage  Core
 * @author      Ivan <ivanzx@msn.com>
 * @created     2010-07-03
 ***********************************************************************/
if(defined("IVANENGINE_CORE_EVENTSINGLETON"))
    die("Redefinition macro in :".__FILE__."(".__LINE__.")");
define("IVANENGINE_CORE_EVENTSINGLETON", true);

require_once (dirname(__FILE__).'/Singleton.php');
require_once (dirname(__FILE__).'/Event/Event.php');

abstract class CEventSingleton extends CSingleton
{
    protected $m_evtProxy   = null;
    public function __construct()
    {
        parent::__construct();
        $this->m_evtProxy  = new CEvent();
    }
    
    public function __destruct()
    {
        unset($this->m_evtProxy);
        parent::__destruct();
    }
    
    public function AddEvent($evtName)
    {
        $this->m_evtProxy->AddEvent($evtName);
    }
    
    public function RemoveEvent($evtName)
    {
        $this->m_evtProxy->RemoveEvent($evtName);
    }
    
    public function RemoveAllEvent()
    {
        $this->m_evtProxy->RemoveAllEvent();
    }
    
    public function EnableEvent($enable)
    {
        $this->m_evtProxy->EnableEvent($enable);
    }
    
    public function IsEnableEvent()
    {
        return $this->m_evtProxy->IsEnableEvent();
    }
    
    public function Subscribe($evtName,CEventCallBack $callback)
    {
        $this->m_evtProxy->Subscribe($evtName, $callback);
    }
    
    public function FireEvent($evtName, CEventArgs $evtArgs)
    {
        $this->m_evtProxy->FireEvent($evtName, $evtArgs);
    }
}
?>
